﻿using Domain.Entities;
using Domain.IRepositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Application.ArticleTypeApp
{
    public class ArticleTypeAppService : IArticleTypeAppService
    {

        //用户管理仓储接口
        private readonly IArticleTypeRepository _repository;

        /// <summary>
        /// 构造函数 实现依赖注入
        /// </summary>
        /// <param name="ArticleTypeRepository">仓储对象</param>
        public ArticleTypeAppService(IArticleTypeRepository ArticleTypeRepository)
        {
            _repository = ArticleTypeRepository;
        }

        public ArticleType GetById(Int32 id)
        {
            return _repository.GetById(id);
        }

        public List<ArticleType> GetAll(string key)
        {
            return _repository.GetAll(key).ToList();
        }

        public List<ArticleType> GetPageList(string SearchKeyWords, int PageSize, int PageCurrent, string OrderField, bool OrderDirection = true)
        {

            return _repository.GetPageList(SearchKeyWords, PageSize, PageCurrent, OrderField, OrderDirection).ToList();
        }
        public bool AddOrUpdate(ArticleType model)
        {
            return _repository.AddOrUpdate(model);
        }

        public bool DeleteById(int id)
        {
            return _repository.DeleteById(id);
        }


    }
}
